package com.huike.clues.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * 线索VO（用于前端展示）
 */
@ApiModel(value = "线索视图对象", description = "用于前端展示线索相关信息")
@Data // Lombok注解：自动生成getter、setter、toString、equals、hashCode等方法
public class TbClueVO {

    @ApiModelProperty("线索id")
    private Long id;

    @ApiModelProperty("客户姓名")
    private String name;

    @ApiModelProperty("手机号")
    private String phone;

    @ApiModelProperty("渠道")
    private String channel;

    @ApiModelProperty("活动id")
    private Long activityId;

    @ApiModelProperty("活动信息（活动名称/详情）")
    private String activityInfo;

    @ApiModelProperty("活动名称")
    private String activityName;

    @ApiModelProperty("性别编码（1-男，0-女）")
    private String sex;

    @ApiModelProperty("性别中文显示（男/女/未知）")
    private String sexDesc;

    @ApiModelProperty("年龄")
    private Integer age;

    @ApiModelProperty("微信")
    private String weixin;

    @ApiModelProperty("QQ")
    private String qq;

    @ApiModelProperty("意向等级")
    private String level;

    @ApiModelProperty("意向学科")
    private String subject;

    @ApiModelProperty("状态编码（1-已分配，2-进行中，3-回收，4-伪线索）")
    private String status;

//    @ApiModelProperty("状态中文显示（已分配/进行中/回收/伪线索/未知）")
//    private String statusDesc;

    @ApiModelProperty("伪线索失败次数（最大3次）")
    private Integer falseCount;

    @ApiModelProperty("下次跟进时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date nextTime;

    @ApiModelProperty("是否转派（默认0：否；1：是）")
    private String transfer;

    @ApiModelProperty("线索失效时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime;

    @ApiModelProperty("分配人")
    private String assignBy;

    @ApiModelProperty("分配时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date assignTime;

    @ApiModelProperty("所属人")
    private String owner;

    @ApiModelProperty("所属时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date ownerTime;

    @ApiModelProperty("创建者")
    private String createBy;

    @ApiModelProperty("创建人id")
    private Long userId;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty("更新者")
    private String updateBy;

    @ApiModelProperty("更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    // 手动补充性别编码转中文的逻辑（setter触发）
    public void setSex(String sex) {
        this.sex = sex;
        this.sexDesc = "1".equals(sex) ? "男" : "0".equals(sex) ? "女" : "未知";
    }

    // 手动补充状态编码转中文的逻辑（setter触发）
    public void setStatus(String status) {
        this.status = status;
        switch (status) {
            case "1":
                this.status = "已分配";
                break;
            case "2":
                this.status = "进行中";
                break;
            case "3":
                this.status = "回收";
                break;
            case "4":
                this.status = "伪线索";
                break;
            default:
                this.status = "未知";
        }
    }
}